# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1Result do
  @moduledoc """
  Result is short for "action result", could be different types identified by "action_result" field. Supported types: 1. DebugInfo : generic debug info collected by runtime recorded as a list of properties. For example, the contents could be virtual host info, state change result, or execution metadata. Required fields : properties, timestamp 2. RequestMessage: information of a http request. Contains headers, request URI and http methods type.Required fields : headers, uri, verb 3. ResponseMessage: information of a http response. Contains headers, reason phrase and http status code. Required fields : headers, reasonPhrase, statusCode 4. ErrorMessage: information of a http error message. Contains detail error message, reason phrase and status code. Required fields : content, headers, reasonPhrase, statusCode 5. VariableAccess: a list of variable access actions, can be Get, Set and Remove. Required fields : accessList

  ## Attributes

  *   `ActionResult` (*type:* `String.t`, *default:* `nil`) - Type of the action result. Can be one of the five: DebugInfo, RequestMessage, ResponseMessage, ErrorMessage, VariableAccess
  *   `accessList` (*type:* `list(GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1Access.t)`, *default:* `nil`) - A list of variable access actions agaist the api proxy. Supported values: Get, Set, Remove.
  *   `content` (*type:* `String.t`, *default:* `nil`) - Error message content. for example, "content" : "{\\"fault\\":{\\"faultstring\\":\\"API timed out\\",\\"detail\\":{\\"errorcode\\":\\"flow.APITimedOut\\"}}}"
  *   `headers` (*type:* `list(GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1Property.t)`, *default:* `nil`) - A list of HTTP headers. for example, '"headers" : [ { "name" : "Content-Length", "value" : "83" }, { "name" : "Content-Type", "value" : "application/json" } ]'
  *   `properties` (*type:* `GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1Properties.t`, *default:* `nil`) - Name value pairs used for DebugInfo ActionResult.
  *   `reasonPhrase` (*type:* `String.t`, *default:* `nil`) - HTTP response phrase
  *   `statusCode` (*type:* `String.t`, *default:* `nil`) - HTTP response code
  *   `timestamp` (*type:* `String.t`, *default:* `nil`) - Timestamp of when the result is recorded. Its format is dd-mm-yy hh:mm:ss:xxx. For example, `"timestamp" : "12-08-19 00:31:59:960"`
  *   `uRI` (*type:* `String.t`, *default:* `nil`) - The relative path of the api proxy. for example, `"uRI" : "/iloveapis"`
  *   `verb` (*type:* `String.t`, *default:* `nil`) - HTTP method verb
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :ActionResult => String.t() | nil,
          :accessList => list(GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1Access.t()) | nil,
          :content => String.t() | nil,
          :headers => list(GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1Property.t()) | nil,
          :properties => GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1Properties.t() | nil,
          :reasonPhrase => String.t() | nil,
          :statusCode => String.t() | nil,
          :timestamp => String.t() | nil,
          :uRI => String.t() | nil,
          :verb => String.t() | nil
        }

  field(:ActionResult)
  field(:accessList, as: GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1Access, type: :list)
  field(:content)
  field(:headers, as: GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1Property, type: :list)
  field(:properties, as: GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1Properties)
  field(:reasonPhrase)
  field(:statusCode)
  field(:timestamp)
  field(:uRI)
  field(:verb)
end

defimpl Poison.Decoder, for: GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1Result do
  def decode(value, options) do
    GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1Result.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Apigee.V1.Model.GoogleCloudApigeeV1Result do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
